<!DOCTYPE html>
<html lang=zh-CN>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta property="og:description" content="伍一的笔记，Kool&#39;s Blog">
    <meta property="og:type" content="website">
    <meta name="description" content="伍一的笔记，Kool&#39;s Blog">
    <meta name="keyword"  content="伍一,伍一的博客">
    <link rel="shortcut icon" href="/img/favicon.ico">

    <title>
        
        找回丢失的hexo博客-2023.12 - 伍一的笔记 | Kool&#39;s Blog
        
    </title>

    <!-- Custom CSS -->
    
<link rel="stylesheet" href="/css/aircloud.css">

    
<link rel="stylesheet" href="/css/gitment.css">

    <!--<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">-->
    <link href="//at.alicdn.com/t/font_620856_28hi1hpxx24.css" rel="stylesheet" type="text/css">
    <!-- ga & ba script hoook -->
    <script></script>

    







  
  
  
    <script type="text/javascript">
      var _hmt = _hmt || []
      ;(function () {
        var hm = document.createElement('script')
        hm.src = 'https://hm.baidu.com/hm.js?7e771422dc6f742629fa26747480f822'
        var s = document.getElementsByTagName('script')[0]
        s.parentNode.insertBefore(hm, s)
      })()
    </script>
  



<meta name="generator" content="Hexo 6.3.0"></head>

<body>

<div class="site-nav-toggle" id="site-nav-toggle">
    <button>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
    </button>
</div>

<div class="index-about">
    <i> 爱生活爱编码 </i>
</div>

<div class="index-container">
    
    <div class="index-left">
        
<div class="nav" id="nav">
    <div class="avatar-name">
        <div class="avatar radius">
            <img src="/img/zkool.png" />
        </div>
        <div class="name">
            <i>伍一</i>
        </div>
    </div>
    <div class="contents" id="nav-content">
        <ul>
            <li >
                <a href="/">
                    <i class="iconfont icon-shouye1"></i>
                    <span>主页</span>
                </a>
            </li>
            <li >
                <a href="/html/scanner/index.html">
                    <i class="iconfont icon-guidang2"></i>
                    <span>H5条码枪</span>
                </a>
            </li>
            <li >
                <a href="/html/udi/index.html">
                    <i class="iconfont icon-sousuo1"></i>
                    <span>UDI</span>
                </a>
            </li>
            <li >
                <a href="/tags">
                    <i class="iconfont icon-biaoqian1"></i>
                    <span>标签</span>
                </a>
            </li>
            <li >
                <a href="/archives">
                    <i class="iconfont icon-guidang2"></i>
                    <span>存档</span>
                </a>
            </li>
            <li >
                <a href="/collect/">
                    <i class="iconfont icon-shoucang1"></i>
                    <span>收藏</span>
                </a>
            </li>
            <li >
                <a href="/about/">
                    <i class="iconfont icon-guanyu2"></i>
                    <span>关于</span>
                </a>
            </li>
            
            <li>
                <a id="search">
                    <i class="iconfont icon-sousuo1"></i>
                    <span>搜索</span>
                </a>
            </li>
            
        </ul>
    </div>
    
        <div id="toc" class="toc-article">
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E9%9C%80%E6%B1%82"><span class="toc-text">需求</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%BB%E5%8A%A1%E8%A7%A3%E6%9E%90"><span class="toc-text">任务解析</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%AE%9E%E6%88%98"><span class="toc-text">实战</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9"><span class="toc-text">注意事项</span></a></li></ol>
</div>
    
</div>


<div class="search-field" id="search-field">
    <div class="search-bg" id="search-bg"></div>
    <div class="search-container">
        <div class="search-input">
            <span id="esc-search"> <i class="icon-fanhui iconfont"></i></span>
            <input id="search-input"/>
            <span id="begin-search">搜索</span>
        </div>
        <div class="search-result-container" id="search-result-container">

        </div>
    </div>
</div>

        <div class="index-about-mobile">
            <i> 爱生活爱编码 </i>
        </div>
    </div>
    
    <div class="index-middle">
        <!-- Main Content -->
        


<div class="post-container">
    <div class="post-title">
        找回丢失的hexo博客-2023.12
    </div>

    <div class="post-meta">
        <span class="attr">发布于：<span>2023-12-23 20:03:08</span></span>
        
        <span class="attr">标签：/
        
        <a class="tag" href="/tags/#编程综合" title="编程综合">编程综合</a>
        <span>/</span>
        
        
        </span>
        <span class="attr">访问：<span id="busuanzi_value_page_pv"></span>
</span>
</span>
    </div>
    <div class="post-content ">
        <p>好久没有静下来，写些东西了。。。做了这么多年的程序员，已经没有刚参加工作时充沛的精力和好奇心了，但是反过来，我想做一件事时，我知道我想要啥信息，我有各种办法找到我想要的信息，以快速达成目标，这或许就是经验。</p>
<p>最近想在网上挂个web网页，就想起来了几年前用hexo搭建的博客，地址是这个 <a href="https://zkool.gitee.io/">https://zkool.gitee.io/</a> 想往这个博客上加个web网页。突然发现这博客的原始文件找不到了，原始文件也没上传到gitee上，这几年换了几台电脑了，最后在古董笔记本里找到了，找到后又发现这几年过去了，里面的各种依赖版本也太低了，回忆回忆重新搭吧。</p>
<h1 id="需求"><a href="#需求" class="headerlink" title="需求"></a>需求</h1><p>恢复几年前的hexo搭建的个人博客</p>
<h1 id="任务解析"><a href="#任务解析" class="headerlink" title="任务解析"></a>任务解析</h1><ul>
<li><p>hexo是什么：快速、简洁且高效的博客框架。<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn">https://hexo.io/zh-cn</a></p>
</li>
<li><p>hexo前置环境：安装Node.js和Git；github或gitee上创建仓库并开启pages服务</p>
</li>
<li><p>开发工具用什么：前端同事都在用vscode。<a target="_blank" rel="noopener" href="https://code.visualstudio.com/">https://code.visualstudio.com/</a>；不熟悉这个开发工具，装个汉化插件吧【</p>
<p>Chinese (Simplified) (简体中文) Language Pack for Visual Studio Code</p>
<p>】，hexo需要用markdown写文章内容，市面上各种所见即所得工具，我们始终是懒人，装个markdown编辑器插件吧【vscode-yarkdown】。</p>
</li>
<li><p>hexo主题(皮肤)：自带的默认主题太不个性了，以前找的这个【hexo-theme-aircloud】<a target="_blank" rel="noopener" href="https://github.com/aircloud/hexo-theme-aircloud">https://github.com/aircloud/hexo-theme-aircloud</a>，就还用这个吧。</p>
</li>
</ul>
<h1 id="实战"><a href="#实战" class="headerlink" title="实战"></a>实战</h1><ul>
<li><p>hexo常用命令：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line">#安装hexo-cli</span><br><span class="line">npm install hexo-cli -g</span><br><span class="line">#初始化你的blog</span><br><span class="line">hexo init blog</span><br><span class="line"></span><br><span class="line">#进主题目录</span><br><span class="line">cd blog\themes</span><br><span class="line"></span><br><span class="line">#下载主题</span><br><span class="line">git clone https://github.com/aircloud/hexo-theme-aircloud aircloud</span><br><span class="line"></span><br><span class="line">#回到上级目录</span><br><span class="line">cd ..</span><br><span class="line"></span><br><span class="line">#安装依赖</span><br><span class="line">npm install</span><br><span class="line"></span><br><span class="line">#按需修改配置文件_config.yml</span><br><span class="line">#设置主题名称</span><br><span class="line"># Extensions</span><br><span class="line">## Plugins: https://hexo.io/plugins/</span><br><span class="line">## Themes: https://hexo.io/themes/</span><br><span class="line">theme: aircloud</span><br><span class="line">#配置Deployment</span><br><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  repo: git@github.com:yourname/yourname.github.io.git</span><br><span class="line">  branch: master</span><br><span class="line"></span><br><span class="line">//安装所需git插件</span><br><span class="line">npm install hexo-deployer-git --save</span><br><span class="line"></span><br><span class="line">hexo clean #清空缓存</span><br><span class="line">hexo g #完整命令为hexo generate,用于生成静态文件</span><br><span class="line">hexo s #完整命令为hexo server,用于启动服务器，主要用来本地预览</span><br><span class="line">hexo d #完整命令为hexo deploy,用于将本地文件发布到github或gitee上</span><br><span class="line">hexo n #完整命令为hexo new,用于新建一篇文章</span><br></pre></td></tr></table></figure>
</li>
<li><p>hexo d会发布到git服务端，对应git服务（github或gitee）的pages能力，怎么配置pages可自行百度学习，当是给想动手操作的同学留的作业。</p>
</li>
<li><p>视频介绍地址：<a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1YN4y1s7RE">https://www.bilibili.com/video/BV1YN4y1s7RE</a></p>
</li>
</ul>
<h1 id="注意事项"><a href="#注意事项" class="headerlink" title="注意事项"></a>注意事项</h1><ol>
<li><p>hexo d 命令发布到git服务上的内容是hexo生成的博客的静态文件，并不是原始博客markdown文件</p>
</li>
<li><p>为了避免博客原markdown文件丢失，还需要建立一个git仓库，把原文件也管理起来</p>
</li>
</ol>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git init</span><br><span class="line">git remote add origin 仓库url</span><br></pre></td></tr></table></figure>
        
            <div class="donate-container">
    <div class="donate-button">
        <button id="donate-button">赞赏</button>
    </div>
    <div class="donate-img-container hide" id="donate-img-container">
        <img id="donate-img" src="" data-src="/img/my_wechat.jpg">
        <p> 感谢鼓励 </p>
    </div>
</div>
        
        <br />
        <div id="comment-container">
        </div>
        <div id="disqus_thread"></div>
        <div id="lv-container"></div>
        <div class="giscus"></div>
    </div>
</div>

    </div>
</div>


<footer class="footer">
    <ul class="list-inline text-center">
        
        

        
        <li>
            <a target="_blank" href="http://weibo.com/zha0ku1">
                            <span class="fa-stack fa-lg">
                                  <i class="iconfont icon-weibo"></i>
                            </span>
            </a>
        </li>
        

        

        
        <li>
            <a target="_blank"  href="https://github.com/zkool">
                            <span class="fa-stack fa-lg">
                                <i class="iconfont icon-github"></i>
                            </span>
            </a>
        </li>
        

        

    </ul>
    
    <p>
        <span>/</span>
        
        <span><a target="_blank" rel="noopener" href="https://niexiaotao.com">Xiaotao&#39;s Page</a></span>
        <span>/</span>
        
        <span><a href="#">It helps SEO</a></span>
        <span>/</span>
        
    </p>
    
    <p>
        <span id="busuanzi_container_site_pv">
            <span id="busuanzi_value_site_pv"></span>PV
        </span>
        <span id="busuanzi_container_site_uv">
            <span id="busuanzi_value_site_uv"></span>UV
        </span>
        Created By <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a>  Theme <a target="_blank" rel="noopener" href="https://github.com/aircloud/hexo-theme-aircloud">AirCloud</a></p>
</footer>




</body>

<script>
    // We expose some of the variables needed by the front end
    window.hexo_search_path = "search.json"
    window.hexo_root = "/"
    window.isPost = true
</script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

<script src="/js/index.js"></script>

<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>






</html>
